﻿function share()
{
    $('.layer').css('display', 'block');
    //event.preventDefault();
    //event.stopPropagation();
    document.documentElement.style.overflowY = 'hidden';
    //var src = $($(this).parent().prev()).attr("src");
    var a = this.tagName
    alert(a)
   // $('.pop-img').attr("src",src);
    $('.layer').click(function (e) {
        $('.layer').fadeOut(200);

        document.documentElement.style.overflowY = '';
    })
}
$(function () {
    $('.pop-click').click(function (e) {
        $('.layer').fadeIn(200);
        $('.pop').fadeIn(200);
        var src = $($(this).parent().prev()).attr("alt");
        var nowScrollTop = $(window).scrollTop();
        $(window).scroll(function(){
            $(this).scrollTop(nowScrollTop);
        });
         $('.pop-img').attr("src",src);
        $('.layer').click(function (e) {
            $('.layer').fadeOut(200);
            $('.pop').fadeOut(200);
            $(window).unbind('scroll');
        })
        $('.pop').click(function (e) {
            $('.layer').fadeOut(200);
            $('.pop').fadeOut(200);
            $(window).unbind('scroll');
        })

        var winheight = $(window).height();
        var imgheight = $('.pop-img').height();
        if (imgheight <= 300)
            imgheight = 300;
        var center = winheight / 2 - imgheight;
        $('.pop').css('padding-top', center.toString()+"px");
    })

})


